package com.lvmama.controller;

import com.lvmama.base.ResultBase;
import com.lvmama.entity.User;
import com.lvmama.service.UserService;
import com.lvmama.system.dao.UserDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/user")
public class UserController {

    @Autowired
    UserDao userDao;
    @Autowired
    UserService userService;

    @GetMapping("/findAll")
    public List<User> findAll(){
        List<User> list = userDao.findAll();

        return list;
    }

    @GetMapping("/findByUsername")
    public ResultBase<User> findByUsername(String username) {
        ResultBase<User> result = userService.findByUsername(username);
        return result;
    }
}
